<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="https://pythonhosted.org/pickleDB/favicon.ico" type="image/x-icon">
    <link rel="icon" href="https://pythonhosted.org/pickleDB/favicon.ico" type="image/x-icon">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
    <title>pickleDB - Simple Key-Value Database</title>
    <style>
        body {
            font-family: 'Poppins', sans-serif;
            margin: 0;
            padding: 0;

            color: #333;
        }
        .container {
            max-width: 800px;
            margin: auto;
            margin-top: auto;
            margin-bottom: auto;
            background: #fff;
            padding: 40px;
            border-radius: 15px;
            text-align: center;
        }
        h1, h2 {
            font-weight: 600;
        }
        h2 {
            color: #008000;
            text-align: left;
        }
        p {
            font-size: 18px;
            line-height: 1.6;
            color: #555;
            text-align: left;
        }
        ul {
            text-align: left;
        }
        a {
            color: #008000;
            text-decoration: none;
            font-weight: 600;
            transition: color 0.3s ease;
        }
        a:hover {
            color: #008000;
        }
        pre {
            background: #f5f2f0;
            padding: 20px;
            border-radius: 10px;
            text-align: left;
            overflow-x: auto;
            font-size: 1.1em;
        }
        .logo img {
            max-width: 600px;
        }
        span.c2 {
            color: #8F5902;
        }
        span.c9 {
            color: #008000;
        }
        .github-banner img {
            position: fixed;
            top: 0;
            right: 0;
            border: 0;
        }
        .button-container {
            display: flex;
            justify-content: space-between;
            gap: 10px;
            align-items: center;
        }
        .button {
            display: flex; /* Use flexbox for proper vertical centering */
            align-items: center; /* Vertically center the text */
            justify-content: center; /* Horizontally center the text */
            background: #008000;
            color: #fff;
            padding: 0 30px; /* Only horizontal padding */
            height: 100px; /* Set a fixed height for both buttons */
            border-radius: 30px;
            font-size: 18px;
            font-weight: 600;
            text-align: center;
            width: 48%; /* Ensure both buttons take up equal width */
            transition: background 0.3s ease;
        }
        .button:hover {
            background: white;
            border: 2px solid #008000;
            color: #008000;
        }
        .left-button {
            margin-right: 10px;
        }
        .right-button {
            margin-left: 10px;
        }
        @media (max-width: 768px) {
            .container {
                width: 100%;
                padding: 20px;
            }
            .logo img {
                max-width: 100%;
            }
            .button {
                max-width: 100%;
                text-align: center;
                align-items: center
            }
            .github-banner {
                display: none;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="logo">
            <a href="index.html"><img src="logo.png" alt="pickleDB logo"></a>
        </div>
        <h1>API Documentation</h1>

        <p>
            <h2>PickleDB()</h2>
        </p>

        <p><code><span class="c2">PickleDB</span>(<span class="c9">path</span>)</code> &rarr; Initialize a PickleDB instance with the specified path.</p>
        <ul>
            <li><span class="c9">path</span>: The path to the database file.</li>
        </ul>

        <p>
            <strong><code><span class="c2">PickleDB</span></code> Class Methods</strong>
        </p>

        <p><code><span class="c2">set</span>(<span class="c9">key</span>, <span class="c9">value</span>)</code> &rarr; Add or update a key-value pair in the database.</p>
        <ul>
            <li><span class="c9">key</span>: The key to set. Converted to string if not already.</li>
            <li><span class="c9">value</span>: The value to associate with the key. This can be any JSON serializable Python data type.</li>
            <li><span class="c9">Returns</span>: <em>True</em>.</li>
        </ul>

        <p><code><span class="c2">get</span>(<span class="c9">key</span>)</code> &rarr; Retrieve the value associated with a key.</p>
        <ul>
            <li><span class="c9">key</span>: The key to retrieve.</li>
            <li><span class="c9">Returns</span>: The value associated with the key, or <em>None</em> if the key does not exist.</li>
        </ul>

        <p><code><span class="c2">remove</span>(<span class="c9">key</span>)</code> &rarr; Delete a key and its value from the database.</p>
        <ul>
            <li><span class="c9">key</span>: The key to delete.</li>
            <li><span class="c9">Returns</span>: <em>True</em> if the key was deleted, or <em>False</em> if the key does not exist.</li>
        </ul>

        <p><code><span class="c2">all</span>()</code> &rarr; Retrieve a list of all keys in the database.</p>
        <ul>
            <li><span class="c9">Returns</span>: A list of keys.</li>
        </ul>

        <p><code><span class="c2">purge</span>()</code> &rarr; Clear all keys and values from the database.</p>
        <ul>
            <li><span class="c9">Returns</span>: <em>True</em>.</li>
        </ul>

        <p><code><span class="c2">save</span>(<span class="c9">option</span>)</code> &rarr; Save the current state of the database to the file.</p>
        <ul>
            <li><span class="c9">option</span>: OPTIONAL argument to pass `orjson.OPT_*` flags to configure serialization behavior.</li>
            <li><span class="c9">Returns</span>: <em>True</em> if the operation succeeds, or <em>False</em> otherwise.</li>
        </ul>

        <h2>AsyncPickleDB(PickleDB)</h2>
        <p><code><span class="c2">AsyncPickleDB</span>(<span class="c9">path</span>)</code> &rarr; Initialize an AsyncPickleDB instance with the specified path.</p>
        <ul>
            <li><span class="c9">path</span>: The path to the database file.</li>
        </ul>

        <p>
            <strong><code><span class="c2">AsyncPickleDB</span></code> Class Methods</strong>
        </p>

        <p><code><span class="c2">aset</span>(<span class="c9">key</span>, <span class="c9">value</span>)</code> &rarr; Asynchronously add or update a key-value pair in the database.</p>
        <ul>
            <li><span class="c9">key</span>: The key to set. Converted to string if not already.</li>
            <li><span class="c9">value</span>: The value to associate with the key. This can be any JSON serializable Python data type.</li>
            <li><span class="c9">Returns</span>: <em>True</em>.</li>
        </ul>

        <p><code><span class="c2">aget</span>(<span class="c9">key</span>)</code> &rarr; Asynchronously retrieve the value associated with a key.</p>
        <ul>
            <li><span class="c9">key</span>: The key to retrieve.</li>
            <li><span class="c9">Returns</span>: The value associated with the key, or <em>None</em> if the key does not exist.</li>
        </ul>

        <p><code><span class="c2">aremove</span>(<span class="c9">key</span>)</code> &rarr; Asynchronously delete a key and its value from the database.</p>
        <ul>
            <li><span class="c9">key</span>: The key to delete.</li>
            <li><span class="c9">Returns</span>: <em>True</em> if the key was deleted, or <em>False</em> if the key does not exist.</li>
        </ul>

        <p><code><span class="c2">aall</span>()</code> &rarr; Asynchronously retrieve a list of all keys in the database.</p>
        <ul>
            <li><span class="c9">Returns</span>: A list of keys.</li>
        </ul>

        <p><code><span class="c2">apurge</span>()</code> &rarr; Asynchronously clear all keys and values from the database.</p>
        <ul>
            <li><span class="c9">Returns</span>: <em>True</em>.</li>
        </ul>

        <p><code><span class="c2">asave</span>()</code> &rarr; Asynchronously save the current state of the database to the file.</p>
        <ul>
            <li><span class="c9">Returns</span>: <em>True</em> if the operation succeeds, or <em>False</em> otherwise.</li>
        </ul>

        <h1>Suggestions</h1>
        <p>If you would like to suggest an improvement or report an issue, please create an <a href="https://github.com/patx/pickledb/issues">issue on GitHub</a>.</p>
    </div>
</body>
</html>
